This invention relates generally to computer systems and, more particularly, to a method and system in a computer system for automatically running a program stored on a medium upon detection of insertion of the medium into a drive.
Application programs are commonly stored on removable media, e.g., floppy disks and CD-ROMs. When a user desires to run an application program stored on a particular medium, the user inserts the medium into the drive and then commands the operating system to run the program. The operating system then performs the necessary steps to run the program.
Conventional operating systems detect when a medium has been inserted into a drive by monitoring the drive or accessing the medium. For example, the operating system might access the medium in response to a request from a user to read from or write to the medium. When the operating system attempts to complete the requested access, the operating system detects whether a medium is present and thus, whether a medium has been inserted into the drive. Further, conventional operating systems cannot automatically run an application program on a medium. The operating system typically only runs a program in response to a request to run the program. For example, the user might enter a run command at the operating system""s command line.
Users are demanding greater ease of use from computers. Users want to use programs, they do not want to have to perform a series of steps to use the programs. Thus, a method and system for automatically running a program stored on a medium upon detection of insertion of the medium into a drive are beneficial. Such a method and system are beneficial because they enable a user to run a program without any action being required on the part of the user (other than inserting the medium into the drive).
One aspect of the present invention provides a method and system for automatically running a program stored on a medium upon detection of insertion of the medium into a drive. The operating system periodically polls the drive regarding the status of the drive. After receiving a response from the drive regarding the drive""s status, the operating system determines whether the drive""s status has changed. If the drive""s status has changed, the operating system broadcasts a message indicating the change in the drive""s status. When the shell receives a message from the operating system indicating a change in the drive""s status, the shell determines whether the change in the drive""s status indicates that a medium has been inserted into the drive. If the change in the drive""s status indicates that a medium has been inserted into the drive, the shell searches for a predefined file on the medium. The shell then runs a program stored on the medium that is specified in the predefined file. Thus, the running of the program on the medium is performed without any action being required on the part of a user.